cmake_minimum_required(VERSION 3.16)

project(FullProcessDataTransfer LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core )
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network Sql Gui)

add_executable(FullProcessDataTransfer
  main.cpp
  tcptransfer.h tcptransfer.cpp
  database/databaseadapter.h database/databaseadapter.cpp
  database/sqlserverconnector.h database/sqlserverconnector.cpp
  database/database.h database/database.cpp
  database/mysqlconnctor.h database/mysqlconnctor.cpp
  Threadbase/findmssqldatathread.h Threadbase/findmssqldatathread.cpp
  dataTypes.h
  utils/imgfileutils.h utils/imgfileutils.cpp
)


#添加库

include_directories(${CMAKE_SOURCE_DIR}/include) #头文件
find_library(X_LIB NAMES XuanCommon PATHS ${CMAKE_SOURCE_DIR}/include) #库路径



include(GNUInstallDirs)
install(TARGETS FullProcessDataTransfer
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

target_link_libraries(FullProcessDataTransfer
    Qt${QT_VERSION_MAJOR}::Core
    Qt6::Network
    Qt6::Sql
    Qt6::Gui
    ${X_LIB}
)
